<?
function sms_send($user_id,$password,$mobile_phone,$msg,$send_date,$subCode)
/*
php 发送HTTP POST数据函数
*/
{
       //生成请求字串
       $request = 'user_id=' . urlencode($user_id); 
       $request .= '&password=' . urlencode($password); 
       $request .= '&mobile_phone=' . urlencode($mobile_phone);
       $request .= '&msg=' . urlencode($msg);
       $request .= '&send_date=' . urlencode($send_date);
       $request .= '&subCode=' . urlencode($subCode);
       // 生成HTTP头
       $header = "POST http://bms.hichina.com/sms_gateway/sms_api HTTP/1.0\r\n"; 
       $header .= "Content-type: application/x-www-form-urlencoded\r\n"; 
       $header .= "Content-length: " . strlen($request) . "\r\n\r\n"; 
       // 打开连接
       $fp = fsockopen('bms.hichina.com', 80, &$err_num, &$err_msg,30); 
       if (!$fp) 
          $response="网络忙请稍候再试";
       else
       { 
              //发送请求信息
              fputs($fp, $header . $request); 
              //得到返回值 
              while (!feof($fp)) 
              $response .= fgets($fp, 128); 
       }
       $strarray=split("\r\n\r\n",$response);
       $res=$strarray[1];
       return  Chop($res); 
}
//调用例子
//$ret=sms_send('4003','XXXXXX','13900000000','test msg from php code','','4003');
//输出返回结果
//echo "$ret";
?>